﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Web.Configuration;

namespace WebApplication1
{
    public partial class addnwcd : System.Web.UI.Page
    {
        SqlConnection cnn = new SqlConnection(WebConfigurationManager.AppSettings["connect"]);
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DropDownList1.Items.Add("English");
                DropDownList1.Items.Add("Hindi");
                DropDownList1.Items.Add("Kannada");
            }
        }

        protected void btnsave_Click(object sender, EventArgs e)
        {
            cnn.Open();
            SqlCommand cmd = new SqlCommand("insert into newcd values('" + txtcdname.Text + "','" + DropDownList1.SelectedItem + "','" + DropDownList1.SelectedItem + "','" + txtpub.Text + "','" + txtyr.Text + "','" + txtprice.Text + "')", cnn);
            cmd.ExecuteNonQuery();
            cnn.Close();
            Response.Redirect("~/Admin/addnwcd.aspx");
        }
    }
}